package dgut.party.business.dao.rbac;

import dgut.party.business.entity.rbac.Role;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface RoleRepository extends JpaRepository<Role, Long> {
  Role findByName(String name);

  @Query("select r from Role r Join Fetch r.authorities")
  List<Role> findAllRoleWithAuthority();
}
